package com.jcz.web;

import java.util.List;

import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import com.jcz.biz.Vote_SubjectBiz;
import com.jcz.biz.Vote_UserBiz;
import com.jcz.bizImpl.Vote_SubjectBizImpl;
import com.jcz.bizImpl.Vote_UserBizImpl;
import com.jcz.entity.Vote_Subject;
import com.jcz.entity.Vote_User;
import com.opensymphony.xwork2.ActionSupport;

public class LoginAction extends ActionSupport {

	private Vote_User user;

	public Vote_User getUser() {
		return user;
	}

	public void setUser(Vote_User user) {
		this.user = user;
	}

	@Override
	public String execute() throws Exception {
		Vote_UserBiz uBiz=new Vote_UserBizImpl();
		Vote_SubjectBiz sBiz=new Vote_SubjectBizImpl();
		Vote_User user2=null;
		
		user2=uBiz.login(this.getUser());/*登陆查询*/
		
		HttpSession session=ServletActionContext.getRequest().getSession();/*耦合*/
		if(user2!=null){
			session.setAttribute("login", user2);/*保持登陆信息*/
			return SUCCESS;
		}else{
			return "fail";
		}
		
	}
	
	
}
